<template>
  <div>
    <h1>测试</h1>
    <p>计数器：{{count}},{{doubleCount}}</p>
    <p>{{student}}</p>
    <p>{{students}}</p>
    <p>a:{{a}},b:{{b}}</p>
    <input type="button" value="++" @click="increment">

  </div>
</template>

<script setup>
import {ref,reactive,computed,onMounted} from 'vue';
import { storeToRefs } from 'pinia'
import useIndexStore from '../store';
import useStudentStore from '../store/student.js';
const indexStore = useIndexStore();
const studentStore = useStudentStore();
const {count,doubleCount} = storeToRefs(indexStore);
const {student,students} = storeToRefs(studentStore);

const a = ref({cnt:0});
let b = reactive({cnt:0});

function increment(){
    // indexStore.$patch({
    //     count:indexStore.count + 1
    // });
    
    // indexStore.count++;
    // console.log(doubleCount.value);
    // studentStore.student = {name:"张三",age:20};
    // studentStore.students = [...students.value,{name:"张三",age:20}]
    // indexStore.increment(10);
    console.log(b)
    a.value.cnt++;
    b = {cnt:1};
}
</script>

<style>

</style>